﻿@model Customers
@section ToolBar{
    <div class="r-c-tool">
        <a href="javascript:location.reload();" class="l-btn fa fa-refresh"></a>
        <a href="javascript:void(0);" class="l-btn fa fa-search"></a>
    </div>
    <div class="r-c-list">
        <a class="l-btn cur" href="#">全部客户</a>
        <a class="l-btn" href="#">待处理订单</a>
        <a class="l-btn" href="#">未完成订单</a>
        @Html.LActionLink("新建客户", "Edit", "Customer", null, new { @class = "l-btn" })
    </div>

    @*<div class="r-c-search fr">
            <label class="relative fl">
                <input class="inp-text bc1" type="text" /><a href="javascript:void(0)" class="fa fa-search absolute c5"></a>
            </label>
            <a href="javascript:void(0)" class="senior-search fl">高级<br />搜索</a>
        </div>*@
}
<div class="l-m-table">
    <table>
        <tr class="bgc3">
            <th>客户编号</th>
            <th>客户名称</th>
            <th>企业代码</th>
            <th>联系人</th>
            <th>地址</th>
            <th>客户等级</th>
            <th>应收款</th>
            <th>未完成订单数</th>
            <th>最近订货时间</th>
            <th>负责人</th>
            <th>状态</th>
            <th class="t-c">操作</th>
        </tr>
        @if (Model == null || Model.Items.Count <= 0)
        {
            <tr>
                <td colspan="10" class="t-c c0">暂无记录</td>
            </tr>
        }
        @foreach (Customer c in Model.Items)
        {
            <tr>
                <td>@Html.LActionLink(c.CustomerNo, "Detail", "Customer", new { id = c.CustomerId }, new { single = "single" })</td>
                <td>@c.CustomerName</td>
                <td>@c.CompanyCode</td>
                <td>@c.ContactName</td>
                <td>@c.Address</td>
                <td>@c.CustomerLevel.CustomerLevelName</td>
                <td class="red">@c.ReceivableCapital.MoneyFormat()</td>
                <td>@c.NotCompletedOrderCount</td>
                <td>@c.LatestOrderTime.TimeFormat()</td>
                <td>@c.Employee.EmployeeName</td>
                <td>@c.IsActive.StateFormat()</td>
                <td class="t-c">
                    @Html.LActionLink("修改", "Edit", "Customer", new { id = c.CustomerId }, new { single = "single" })
                    @Html.LAjaxPost("删除", new { customerId = c.CustomerId, url = Url.Action("Delete", "Customer"), callback = "callbackRemoveTr", tag = "delete" })
                    @Html.LAjaxPost(c.IsActive ? "禁用" : "启用", new { customerId = c.CustomerId, isActive = !c.IsActive, url = Url.Action("Active", "Customer") })
                </td>
            </tr>
        }
    </table>
</div>
@section Pager{
    @Html.Pager("Index", "Customer", Model.TotalCount, (int)ViewBag.PageIndex, 20)
}